gtkprintbackendcups: Fix a crash in avahi_create_browsers()
authorCarlos Garcia Campos <cgarcia@igalia.com>
Mon, 25 Mar 2013 12:01:23 +0000 (13:01 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Mon, 25 Mar 2013 13:58:03 +0000 (14:58 +0100)
commit5701681df478f620e889171d8780e013535aa7d8
treedd664d0a8520bf5d078d705665eadfb3f71e08bf
parentb29cd63c381a1f10356e914dfe55b9f47ed05dab
gtkprintbackendcups: Fix a crash in avahi_create_browsers()

In avahi_request_printer_list() a new connection to the DBus system bus
is started asynchronously, but it's not cancellable and it's not taking
any reference of the GtkPrintBackendCups. This means that when the
callback is called, the object might have been destroyed already. We can
just pass the cancellable created and check for the cancelled error in
the callback before trying to use the GtkPrintBackendCups. The code to
cancel avahi operations and to unsibscribe from the DBus signals has
been moved from finalize to dispose to make sure it happens as soon as
possible.

https://bugzilla.gnome.org/show_bug.cgi?id=696553
modules/printbackends/cups/gtkprintbackendcups.c